/*
 *------------------------------------------------------------------------------
 * @File      :    ei_mai_ippu.h
 * @Date      :    2021-4-8
 * @Author    :    lomboswer <lomboswer@lombotech.com>
 * @Brief     :    Media Interface for MADP(Media Development Platform).
 *
 * Copyright (C) 2020-2021, LomboTech Co.Ltd. All rights reserved.
 *------------------------------------------------------------------------------
 */

#ifndef __EI_MAI_IPPU_H__
#define __EI_MAI_IPPU_H__

#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif

#include "ei_mai_common.h"
#include "ei_mai_errno.h"
#include "ei_mai_comm_define.h"

/**
 * @brief Init ippu.
 * @param[in] IppuHdl EI_HANDLE: handle of ippu. It's integer from 0 to 1.
 * @param[in] pstIppuAttr EI_IPPU_ATTR_S: pointer of ippu attribute.Static attribute.
 * @return 0  successful.
 * @return non 0  fail.
 */
EI_S32 EI_MAI_IPPU_Init(EI_HANDLE IppuHdl, EI_HANDLE CameraHdl, EI_IPPU_ATTR_S* pstIppuAttr);

/**
 * @brief Deinit ippu. It must be init first.
 * @param[in] IppuHdl EI_HANDLE : handle of ippu.
 * @return 0  successful.
 * @return non 0  fail.
 */
EI_S32 EI_MAI_IPPU_DeInit(EI_HANDLE IppuHdl);

/**
 * @brief Start ippu. It must be created first.
 * @param[in] IppuHdl EI_HANDLE : handle of ippu.
 * @return 0  successful.
 * @return non 0  fail.
 */
EI_S32 EI_MAI_IPPU_Start(EI_HANDLE IppuHdl);

/**
 * @brief Stop ippu. It must be created first.
 * @param[in] IppuHdl EI_HANDLE : handle of ippu.
 * @return 0  successful.
 * @return non 0  fail.
 */
EI_S32 EI_MAI_IPPU_Stop(EI_HANDLE IppuHdl);

#if 0
/**
 * @brief Link vcap to ippu.
 * @param[in] CameraHdl EI_HANDLE : handle of vcap.
 * @param[in] IppuHdl EI_HANDLE : handle of ippu.
 * @return 0  successful.
 * @return non 0  fail.
 */
EI_S32 EI_MAI_IPPU_Link_VCap(EI_HANDLE CameraHdl, EI_HANDLE IppuHdl);

/**
 * @brief Unlink vcap from ippu.
 * @param[in] CameraHdl EI_HANDLE : handle of vcap.
 * @param[in] IppuHdl EI_HANDLE : handle of ippu.
 * @return 0  successful.
 * @return non 0  fail.
 */
EI_S32 EI_MAI_IPPU_UnLink_VCap(EI_HANDLE CameraHdl, EI_HANDLE IppuHdl);
#endif

/**
 * @brief Set attribute of a port in ippu.
 * @param[in] IppuHdl EI_HANDLE : handle of ippu.
 * @param[in] VPortHdl EI_HANDLE : handle of port. It's integer from 0 to 2.
 * @param[in] pstVPortAttr EI_VPORT_ATTR_S: pointer of vport attribute. Dynamic attribute.
 * @return 0  successful.
 * @return non 0  fail.
 */
EI_S32 EI_MAI_IPPU_Port_SetAttr(EI_HANDLE IppuHdl, EI_HANDLE VPortHdl, EI_VPORT_ATTR_S *pstVPortAttr);

/**
 * @brief Get attribute of a port in ippu.
 * @param[in] IppuHdl EI_HANDLE : handle of ippu.
 * @param[in] VPortHdl EI_HANDLE : handle of port.
 * @param[out] pstVPortAttr EI_VPORT_ATTR_S: pointer of vport attribute.
 * @return 0  successful.
 * @return non 0  fail.
 */
EI_S32 EI_MAI_IPPU_Port_GetAttr(EI_HANDLE IppuHdl, EI_HANDLE VPortHdl, EI_VPORT_ATTR_S *pstVPortAttr);

/**
 * @brief Set attribute of a ext port in ippu.
 * @param[in] IppuHdl EI_HANDLE : handle of ippu.
 * @param[in] VPortHdl EI_HANDLE : handle of ext port. It's integer from 0 to 2.
 * @param[in] VPortHdl EI_HANDLE : handle of port to link
 * @param[in] pstVPortAttr EI_EXT_VPORT_ATTR_S: pointer of ext vport attribute. Dynamic attribute.
 * @return 0  successful.
 * @return non 0  fail.
 */
EI_S32 EI_MAI_IPPU_Ext_port_SetAttr(EI_HANDLE IppuHdl, EI_HANDLE VPortHdl,
					EI_HANDLE VPortHdllink, EI_EXT_VPORT_ATTR_S *pstExtVPortAttr);

/**
 * @brief Get attribute of a ext port in ippu.
 * @param[in] IppuHdl EI_HANDLE : handle of ippu.
 * @param[in] VPortHdl EI_HANDLE : handle of ext port.
 * @param[out] pstVPortAttr EI_EXT_VPORT_ATTR_S: pointer of ext vport attribute.
 * @return 0  successful.
 * @return non 0  fail.
 */
 EI_S32 EI_MAI_IPPU_Ext_Port_GetAttr(EI_HANDLE IppuHdl, EI_HANDLE VPortHdl,
					EI_EXT_VPORT_ATTR_S *pstExtVPortAttr);

/**
 * @brief Set corresponding attributes.
 * @param[in] CameraHdl EI_HANDLE:handle of video capture.
 * @param[in] enCMD EI_MADP_IPPU_CMD_E: Setting command.
 * @param[in] pAttr EI_VOID:The struct of corresponding.Dynamic attribute.
 * @param[in] u32Len EI_U32: length of the extend attribute
 * @return 0  Set corresponding attributes successful.
 * @return non 0  Set corresponding attributes fail.
 */
EI_S32 EI_MAI_IPPU_SetAttrEx(EI_HANDLE CameraHdl, EI_HANDLE VPortHdl,
					EI_MADP_IPPU_CMD_E enCMD, IPPU_ATTREX_S *pstAttrEx);

/**
 * @brief Get corresponding attributes.
 * @param[in] CameraHdl EI_HANDLE:handle of video capture.
 * @param[in] enCMD EI_MADP_IPPU_CMD_E: Getting command.
 * @param[out] pAttr EI_VOID:The struct of corresponding
 * @param[in] u32Len EI_U32: length of the extend attribute
 * @return 0  Get corresponding attributes of capture success.
 * @return Non 0  Get corresponding attributes of capture fail.
 */
EI_S32 EI_MAI_IPPU_GetAttrEx(EI_HANDLE CameraHdl, EI_HANDLE VPortHdl,
					EI_MADP_IPPU_CMD_E enCMD, IPPU_ATTREX_S *pstAttrEx);

/**
 * @brief Start a port in ippu.
 * @param[in] IppuHdl EI_HANDLE : handle of ippu.
 * @param[in] VPortHdl EI_HANDLE : handle of port.
 * @return 0  successful.
 * @return non 0  fail.
 */
EI_S32 EI_MAI_IPPU_Port_Start(EI_HANDLE IppuHdl, EI_HANDLE VPortHdl);

/**
 * @brief Stop a port in ippu.
 * @param[in] IppuHdl EI_HANDLE : handle of ippu.
 * @param[in] VPortHdl EI_HANDLE : handle of port.
 * @return 0  successful.
 * @return non 0  fail.
 */
EI_S32 EI_MAI_IPPU_Port_Stop(EI_HANDLE IppuHdl, EI_HANDLE VPortHdl);

EI_S32 EI_MAI_IPPU_TriggerSnap(EI_HANDLE IppuHdl, EI_HANDLE VPortHdl, EI_U32 u32FrameCnt);

EI_S32 EI_MAI_IPPU_EnableDumpYUV(EI_HANDLE IppuHdl, EI_HANDLE VPortHdl,  EI_U32 u32Depth,
			EI_S32 s32Count, PFN_IPPU_YUVDataProc pfunIppuYUVIppu);

EI_S32 EI_MAI_IPPU_DisableDumpYUV(EI_HANDLE IppuHdl, EI_HANDLE VPortHdl);

#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif

#endif

